import logging

_LOGGER = logging.getLogger(__name__)


class EventPreprocessor:
    def __init__(self, topic, add_prefix=True):
        self.event_data = {}
        self.topic = topic
        self.add_prefix = add_prefix

    def add_event_prefix(self):
        if not self.add_prefix:
            return
        _event_id = self.event_data['_event_id']
        self.event_data = {'_'.join([_event_id, key]) if key[0] != '_' else key: value
                           for key, value in self.event_data.items()}

    def handle(self, event_data):
        raise NotImplementedError
